{% extends "tcms_base.html" %}
{% load static %}
{% load extra_filters %}
{% block subtitle %}Case History{% endblock %}

{% block custom_stylesheet %}
{% endblock %}

{% block custom_javascript %}
<script type="text/javascript" src="{% static 'js/testplan_actions.js' %}"></script>
<script type="text/javascript">
	jQ('.js-one-record').live('click',function() {
		var param = jQ(this).data('param');
		window.location.href='{% url "testcases-text_history" testcase.case_id %}?from_plan={{ testplan.plan_id }}&case_text_version=' + param;
  });
</script>
{% endblock %}

{% block contents %}
<div id="content">
	<h2>{{ testcase.summary }} History</h2>
	<div class="Detailform border-1">
	<table cellpadding="0" cellspacing="0" class="list">
		<tr>
			<th class="lab">Text Version</th>
			<th>Modified Date</th>
			<th>Changed By</th>
		</tr>
		{% for text in test_case_texts %}
		<tr class="{% cycle 'odd' 'even' %} js-one-record" data-param="{{ text.case_text_version }}">
			<td><a href="{% url "testcases-text_history" testcase.case_id %}?from_plan={{ testplan.plan_id }}&case_text_version={{ text.case_text_version }}">{{ text.case_text_version }}</a></td>
			<td>{{ text.create_date }}</td>
			<td>{{ text.author__email }}</td>
		</tr>
		{% ifequal text.case_text_version select_case_text_version %}
		<tr class="hide">
			<td colspan="3">
				<div class="content-wrap">
					{% for text in text_to_show %}
					<div class="action">
						<b>SETUP:</b>
						{{ text.setup|markdown2html }}
					</div>
					<div class="effect">
						<b>ACTION:</b>
						{{ text.action|markdown2html }}
					</div>
					<div class="action">
						<b>EXPECTED RESULT:</b>
						{{ text.effect|markdown2html }}
					</div>
					<div class="effect">
						<b>BREAKDOWN:</b>
						{{ text.breakdown|markdown2html }}
					</div>
					{% endfor %}
				</div>
			</td>
		</tr>
		{% endifequal %}
		{% endfor %}
	</table>
	</div>
</div>
{% endblock %}
